<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>libwebsockets: Logging</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libwebsockets
   </div>
   <div id="projectbrief">Lightweight C library for HTML5 websockets</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__log.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Logging</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga14542b84d2c76efa7814124bb10f9c5f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga14542b84d2c76efa7814124bb10f9c5f"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><b>lws_log_levels</b> { <br />
&#160;&#160;<b>LLL_ERR</b> = 1 &lt;&lt; 0, 
<b>LLL_WARN</b> = 1 &lt;&lt; 1, 
<b>LLL_NOTICE</b> = 1 &lt;&lt; 2, 
<b>LLL_INFO</b> = 1 &lt;&lt; 3, 
<br />
&#160;&#160;<b>LLL_DEBUG</b> = 1 &lt;&lt; 4, 
<b>LLL_PARSER</b> = 1 &lt;&lt; 5, 
<b>LLL_HEADER</b> = 1 &lt;&lt; 6, 
<b>LLL_EXT</b> = 1 &lt;&lt; 7, 
<br />
&#160;&#160;<b>LLL_CLIENT</b> = 1 &lt;&lt; 8, 
<b>LLL_LATENCY</b> = 1 &lt;&lt; 9, 
<b>LLL_COUNT</b> = 10
<br />
 }</td></tr>
<tr class="separator:ga14542b84d2c76efa7814124bb10f9c5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaf5f07837692b2f231a79da8a058288aa"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf5f07837692b2f231a79da8a058288aa"></a>
LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><b>_lws_log</b> (int filter, const char *format,...)</td></tr>
<tr class="separator:gaf5f07837692b2f231a79da8a058288aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga74eb146969f0595e12ea835851b4588e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga74eb146969f0595e12ea835851b4588e"></a>
LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><b>_lws_logv</b> (int filter, const char *format, va_list vl)</td></tr>
<tr class="separator:ga74eb146969f0595e12ea835851b4588e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga42e39775c6b69b7251bdbf5a2cdd5dcd"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__log.html#ga42e39775c6b69b7251bdbf5a2cdd5dcd">lwsl_timestamp</a> (int level, char *p, int len)</td></tr>
<tr class="separator:ga42e39775c6b69b7251bdbf5a2cdd5dcd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga898b1f03872ad019f507d4e35bbefa90"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__log.html#ga898b1f03872ad019f507d4e35bbefa90">lwsl_hexdump</a> (void *buf, size_t len)</td></tr>
<tr class="separator:ga898b1f03872ad019f507d4e35bbefa90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga244647f9e1bf0097ccdde66d74f41e26"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__log.html#ga244647f9e1bf0097ccdde66d74f41e26">lws_set_log_level</a> (int level, void(*log_emit_function)(int level, const char *line))</td></tr>
<tr class="separator:ga244647f9e1bf0097ccdde66d74f41e26"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab7c0fc936cc9f1eb58e2bb234c15147c"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__log.html#gab7c0fc936cc9f1eb58e2bb234c15147c">lwsl_emit_syslog</a> (int level, const char *line)</td></tr>
<tr class="separator:gab7c0fc936cc9f1eb58e2bb234c15147c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2>Logging</h2>
<p>Lws provides flexible and filterable logging facilities, which can be used inside lws and in user code.</p>
<p>Log categories may be individually filtered bitwise, and directed to built-in sinks for syslog-compatible logging, or a user-defined function. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga244647f9e1bf0097ccdde66d74f41e26"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LWS_VISIBLE LWS_EXTERN void lws_set_log_level </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(int level, const char *line)&#160;</td>
          <td class="paramname"><em>log_emit_function</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p><a class="el" href="group__log.html#ga244647f9e1bf0097ccdde66d74f41e26">lws_set_log_level()</a> - Set the logging bitfield </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">level</td><td>OR together the LLL_ debug contexts you want output from </td></tr>
    <tr><td class="paramname">log_emit_function</td><td>NULL to leave it as it is, or a user-supplied function to perform log string emission instead of the default stderr one.</td></tr>
  </table>
  </dd>
</dl>
<p>log level defaults to "err", "warn" and "notice" contexts enabled and emission on stderr. </p>

</div>
</div>
<a class="anchor" id="gab7c0fc936cc9f1eb58e2bb234c15147c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>line</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p><a class="el" href="group__log.html#gab7c0fc936cc9f1eb58e2bb234c15147c">lwsl_emit_syslog()</a> - helper log emit function writes to system log</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">level</td><td>one of LLL_ log level indexes </td></tr>
    <tr><td class="paramname">line</td><td>log string</td></tr>
  </table>
  </dd>
</dl>
<p>You use this by passing the function pointer to <a class="el" href="group__log.html#ga244647f9e1bf0097ccdde66d74f41e26">lws_set_log_level()</a>, to set it as the log emit function, it is not called directly. </p>

</div>
</div>
<a class="anchor" id="ga898b1f03872ad019f507d4e35bbefa90"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LWS_VISIBLE LWS_EXTERN void lwsl_hexdump </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p><a class="el" href="group__log.html#ga898b1f03872ad019f507d4e35bbefa90">lwsl_hexdump()</a> - helper to hexdump a buffer (DEBUG builds only)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>buffer start to dump </td></tr>
    <tr><td class="paramname">len</td><td>length of buffer to dump </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga42e39775c6b69b7251bdbf5a2cdd5dcd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LWS_VISIBLE LWS_EXTERN int lwsl_timestamp </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>p</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p>lwsl_timestamp: generate logging timestamp string</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">level</td><td>logging level </td></tr>
    <tr><td class="paramname">p</td><td>char * buffer to take timestamp </td></tr>
    <tr><td class="paramname">len</td><td>length of p</td></tr>
  </table>
  </dd>
</dl>
<p>returns length written in p </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
